<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<link rel="stylesheet" href="http://127.0.0.1/cms/cms/Template/default/css/style.css" />
<link type="text/css" rel="stylesheet" href="http://127.0.0.1/cms/cms/Static/hdjs/hdjs.css"/>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Static/js/jq17.js"></script>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Static/hdjs/hdjs.js"></script>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Template/default/js/js.js"></script>
<script type="text/javascript">
	var checkUser = "<?php echo U('User/ajaxCheckUser');?>";
	var checkNick = "<?php echo U('User/ajaxCheckNickName');?>";
	var checkCode = "<?php echo U('User/ajaxCheckCode');?>";
	var checkLogin = "http://127.0.0.1/cms/cms/index.php/Index/user/ajaxLoginReturn";
$(function(){
	$('#loginclose').click(function(){
		$(this).parents('.login_hide_box').hide();
	});
	$('#regclose').click(function(){
		$(this).parents('.reg_hide_box').hide();
	});
})
	
</script>
<script src="http://127.0.0.1/cms/cms/Static/js/ajaxlogin.js"></script>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Template/default/js/validate.js"></script>

</head>
<body>
	<!-- 顶部100%灰色区域 -->
	<div id="top_dark_box">
		<!-- 中间1200px宽度区域 -->
		<div id="top_dark">
			<a href="http://127.0.0.1/cms/cms"><img src="http://127.0.0.1/cms/cms/Template/default/images/others/logo.jpg" id="logo" /></a>
			<!-- 导航菜单 -->
			<ul id="menu">
				<?php
	$navList = M('category')->field('cid,cname,ctitle,htmldir,is_archtml')->where('pid=0')->limit(10)->all();
	foreach($navList as $navs):
	$navs['url'] = getCateUrl($navs['is_archtml'],$navs['htmldir'],$navs['cid']);
?>
	
				<li>
					<a href="<?php echo $navs['url'];?>"><?php echo $navs['cname'];?></a>
				</li>
				
<?php
	endforeach;
?>
			</ul>
			<!-- 导航菜单结束 -->
			<!-- 用户登录 -->
			
			<div id="loginInfo" class='loginInfo'>
				<div id="islogin" style="display:none;"><span><?php echo $hd['session']['username'];?></span><a href="http://127.0.0.1/cms/cms/index.php/Index/user/loginout">退出</a></div>
			     <?php if(isset($hd['session']['uid'])){ ?>
				<div id="islogin"><span><?php echo $hd['session']['username'];?></span><a href="http://127.0.0.1/cms/cms/index.php/Index/user/loginout">退出</a></div>
			 <?php } ?>
			 <div id="isout" style="display:block;">
				<a href="javascript:showLoginBox()" class="top_login">用户登录</a>
				<a href="javascript:showRegBox();">注册</a>
				</div>
			</div>
			<!-- 用户登录对应隐藏区域 -->
			<form id="loginForm" action="http://127.0.0.1/cms/cms/index.php/Index/user/login" method="post">
			<div class="login_hide_box">
				
				<img src="http://127.0.0.1/cms/cms/Template/default/images/sanjiao.gif" alt="" />
				<div class="middle">
					<p>用户名：<span id="hd_username"></span> <a href="javascript:;" id="loginclose">关闭</a></p>
					<input type="text" name="username" class="text" />
					<p>密码：<span id="hd_password"></span></p>
					<input type="password" name="password" class="text" />
					<input type="submit" value="" class="sub" />
				</div>
				<div class="bottom">
					<a  href="javascript:showRegBox();" class="reg">注册</a>
				</div>
			</div>
			</form>
			
			<!-- 用户注册对应隐藏区域 -->
			<form id="regForm" action="http://127.0.0.1/cms/cms/index.php/Index/user/register" method="post">	
			<div class="reg_hide_box">
				<img src="http://127.0.0.1/cms/cms/Template/default/images/sanjiao.gif" alt="" />
				<div class="middle">
					<p>用户名：<a href="javascript:;" id="regclose">关闭</a></p>
					<input type="text" name="username_reg" class="text username" />
					<p>昵称：</p>
					<input type="text" name="nickname" class="text nickname" />
					<p>密码：</p>
					<input type="password" name="password_reg1" class="text password" />
					<p>确认密码：</p>
					<input type="password" name="password_reg2" class="text password" />
					<p>验证码：</p>
					<img src="http://127.0.0.1/cms/cms/index.php/Index/user/code" id="code" onclick="this.src=this.src + '&' + Math.random()"/>
					<input type="text"  name="code" class="text password_d" />
					<input type="submit" value="注册" class="sub" />
				</div>
			</div>
			</form>
		</div>
		<!-- 中间1200px宽度区域结束 -->
	</div>
	<!-- 顶部灰色100%区域结束 -->
	
	<!-- 顶部最新消息区域 -->
	<div id="latest_news_box">
		<div id="latest_news">
			<p><span class="title">最新消息：
			<?php
		$result = M('article')->field('htmldir,cname,is_archtml,aid,sendtime,click,title,thumb,digest,author,category_cid')->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where('is_recycle=0')->order('sendtime DESC')->limit(1)->all();
		foreach($result as $v):
			//组合图片图片
			$v['thumb']  = 'http://127.0.0.1/cms/cms/'.$v['thumb'];
			$v['commnum'] = K('Comment')->findCountComment($v['aid']);
			$category = K('Category')->findCate($v['category_cid']);
			$v['category_name'] = $category['cname'];
			//生成连接地址
			$v['url'] = getStaticPath($v['is_archtml'],$v['htmldir'],$v['aid']);
			
			 
?>	
	<a href="<?php echo $v['url'];?>"><?php echo $v['title'];?></a>
<?php
	endforeach;
?>	
			</span>
					
			</p>
		</div>
	</div>
	<!-- 顶部最新消息区域结束 -->
	<!-- 主体区域 -->